package generator;

public abstract class SourceBuilder {
    private String mPkg;
    private String mName;
    private String mDescription;

    public abstract void addMember(String visiblity, String type, String name, String description);

    public abstract String build();

    public void setClass(String pkg, String name, String description) {
        mPkg = pkg;
        mName = name;
        mDescription = description;
    }

    public String getPkg() {
        return mPkg;
    }

    public String getName() {
        return mName;
    }

    public String getDescription() {
        return mDescription;
    }

    public String getFieldName(String field) {
        return "m" + getFirstUppperCase(field);
    }

    public String getFirstUppperCase(String name) {
        if (name.length() == 0) {
            return null;
        } else if (name.length() == 1) {
            return name.toUpperCase();
        }
        return name.substring(0, 1).toUpperCase() + name.substring(1);
    }
}
